<?php 
	namespace Home\Controller;
	use Think\Controller;
	// 公共的控制器类
	class HomeController extends Controller
	{
		// 初始化的方法
		public function _initialize()
		{	
			// 查询友情链接表
			$link = M('links');
			$lianjie = $link->select();
			$this->assign('link',$lianjie);	

			// logo
	    	$b=M('logo')->order('id desc')->find();
	    	$this->assign('b',$b);
	    	
	    	if(empty($_SESSION['home_user'])){
	    		$val['name']="登录";
	    		$val['url']="home/login/index";
	    		$this->assign('val',$val);
	    	}else{
	    		$val['name']=$_SESSION['home_user']['name'];
	    		$val['url']="home/mycenter/index";
	    		$this->assign('val',$val);
	    		
	    		// 用户登录的信息
				$id = $_SESSION['home_user']['id'];
				$home_user = M('user')->where("id=$id")->find();
				// var_dump($home_user);
				$this->assign('home_user',$home_user);	
				$this->assign('phone',$home_user['phone']);	
	    	}
		}
	}